package cn.zeal4j.util.springmail;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.MailMessage;
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.stereotype.Component;

/**
 * @author Administrator
 * @file IntelliJ IDEA Spring-Mail
 * @create 2020 09 22 12:38
 */
@Component
public class MailOrderManager implements OrderManager{

    @Autowired
    private MailSender mailSender;
    @Autowired
    private MailMessage mailMessage;

    public void placeOrder() {
        mailMessage.setTo("zeal4j@qq.com");
        mailMessage.setText("This message powered by Spring-Mail, 测试");
        mailSender.send((SimpleMailMessage) mailMessage);
    }
}
